poc(spacing): Simplify managing whitespace between page sections #1899
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the pull request
Thank you for contributing to the project!
Please use this template to help us handle your PR smoothly.
What
This is a proof of concept to show how Screen, Spotlight, Breakout and a new Page Body component could manage space largely automatically. It allows removing the padding props from Grid.
Check the example pages, ignore the component examples in this PR.
It moves the responsibility for whitespace between components to the parent, where it belongs and prevents having to scatter around margin classes, which is error-prone and subject to the tastes of the implementer. It works well for general cases, but needs a bit more thought for some situations:
main
elament while the breadcrumb shouldn’t. That prevents an approach like<PageBody as="main"><Grid><Grid.Cell><Breadcrumb /><Heading />…
. We might need a prop for Grid Cell to negate the gap at its bottom.gap
needs will sometimes be in the way, e.g. when components that should be separated by grid space must also have a shared parent element, making them grandchildren.Idea: change the concept of a ‘page body’ to a ‘grid gap’ utility. Oh wait, we already have it: it’s called Column.
Why
To simplify assigning white space between large page sections.
How
screen-poc-space.scss
.screen-poc-space.scss
.@use
of the latter to see the pages as intended.Checklist
Before submitting your pull request, please ensure you have done the following. Check each checkmark if you have done so or if it wasn't necessary:
Additional notes